<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="com.lmpop.trade.tb_returngoods.*" %>
<%@ page import="java.util.*" %>
<%@ page import="com.lmpop.frame.util.PageTools" %>
<%@ page import="com.lmpop.trade.ti_personal.Ti_personalInfo" %>
<%@ page import="com.lmpop.trade.ti_attach.Ti_attachInfo" %>
<%
	request.setCharacterEncoding("UTF-8");

	Tb_returngoods tb_returngoods = new Tb_returngoods();

	String user_id = "";
	if(session.getAttribute("session_user_id")!=null){
		user_id = session.getAttribute("session_user_id").toString();
		if(!user_id.equals("771TXP806F41785"))
			tb_returngoods.setUser_id(user_id);
	}

	String s_cust_id = "";	
	if( session.getAttribute("session_cust_id") != null ){
		s_cust_id = session.getAttribute("session_cust_id").toString();
		//tb_returngoods.setCust_id(s_cust_id);
	}

	String s_info_id = "";
	if(request.getParameter("info_id")!=null && !request.getParameter("info_id").equals("")){
		s_info_id = request.getParameter("info_id");
		tb_returngoods.setInfo_id(s_info_id);
	}
	String s_order_no = "";
	if(request.getParameter("s_order_no")!=null && !request.getParameter("s_order_no").equals("")){
		s_order_no = request.getParameter("s_order_no");
		tb_returngoods.setOrder_no(s_order_no);
	}

	Tb_returngoodsInfo tb_returngoodsInfo = new Tb_returngoodsInfo();
	Ti_attachInfo  ti_attachInfo = new Ti_attachInfo(); 
	Ti_personalInfo person = new Ti_personalInfo();
    
	String iStart = "0"; 
	int limit = 20;
	if(request.getParameter("iStart")!=null) iStart = request.getParameter("iStart");
	List list = tb_returngoodsInfo.getListByPage(tb_returngoods,Integer.parseInt(iStart),limit);
	int counter = tb_returngoodsInfo.getCountByObj(tb_returngoods);
	String pageString = new PageTools().getGoogleToolsBar(counter,"index.jsp?info_id="+s_info_id+"&s_order_no="+s_order_no+"&iStart=",Integer.parseInt(iStart),limit);
     
	 String para = "info_id="+s_info_id+"&s_order_no="+s_order_no+"&iStart="+Integer.parseInt(iStart);
	List goodslist = new LinkedList();    
    Map detail = new Hashtable();
%>
<html>
  <head>
    
    <title>退货管理</title>
	<link href="/program/admin/index/css/style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="/js/commen.js"></script>
	<script language="JavaScript">
		function ignoreSpaces(string) {
		var temp = "";
		string = '' + string;
		splitstring = string.split(" ");
		for(i = 0; i < splitstring.length; i++)
		temp += splitstring[i];
		return temp;
		}
	</script>
</head>

<body>
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td width="90%">
				<h1>退货管理</h1>
			</td>
			<td>
				<!--a href="addInfo.jsp"><img src="/program/company/index/images/post.gif" /></a-->
			</td>
		</tr>
	</table>
	
	<form action="index.jsp" name="indexForm" method="post">
	
	<table width="100%" cellpadding="0" cellspacing="0" class="dl_su">
		<tr>
			<td align="left" >
				退货单号:<input name="info_id" type="text" onBlur="this.value=ignoreSpaces(this.value);" />
				订单号:<input name="s_order_no" type="text" onBlur="this.value=ignoreSpaces(this.value);" />
				<input name="searchInfo" type="submit" value="查询"/>	
			</td>
		</tr>
	</table>

	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe">
		<tr><td><%=pageString %></td></tr>
	</table>
	
	<% 
		int listsize = 0;
		if(list!=null && list.size()>0){
			listsize = list.size();
	%>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="90%">
				<!--input type="button" name="delInfo" onclick="delIndexInfo()" value="删除" class="buttab"/-->
			</td>
			<td>
				总计:<%=counter %>条
			</td>
		</tr>
	</table>
	
	<table width="100%" cellpadding="1" cellspacing="1" class="listtab" border="0">
		<tr>
			<td width="50%" align="left" colspan="2">商品信息</td>  
			<td width="15%" align="left">所属订单</td>  
			<td width="15%" align="left">处理状态</td> 
			<td width="15%" align="left">申请时间</td> 
			<td width="10%" align="left">操作</td>
		</tr>
		
		
		<% 
			Hashtable goodsmap = new Hashtable();
			Hashtable map = new Hashtable();
			for(int i=0;i<list.size();i++){

				map = (Hashtable)list.get(i);
				String info_id="",order_no="",cust_id="",goods_id="",goods_name="",money="",returnteamno="",totalmoney="",reason="",in_date="", deal_date="", pub_state="", user_id2="", deal_reason="",file_path="";
					if(map.get("info_id")!=null) info_id = map.get("info_id").toString();
					if(map.get("order_no")!=null) order_no = map.get("order_no").toString();
					if(map.get("cust_id")!=null) cust_id = map.get("cust_id").toString();
					if(map.get("goods_id")!=null) goods_id = map.get("goods_id").toString();
					if(map.get("goods_name")!=null) goods_name = map.get("goods_name").toString();
					if(map.get("money")!=null) money = map.get("money").toString();
					if(map.get("returnteamno")!=null) returnteamno = map.get("returnteamno").toString();
					if(map.get("totalmoney")!=null) totalmoney = map.get("totalmoney").toString();
					if(map.get("reason")!=null) reason = map.get("reason").toString();
					if(map.get("in_date")!=null){
					 in_date = map.get("in_date").toString();
					 if(in_date.length()>19)in_date=in_date.substring(0,19);
					}
					
					if(map.get("user_id")!=null)user_id = map.get("user_id").toString();
					if(map.get("pub_state")!=null)pub_state = map.get("pub_state").toString();
					if(map.get("deal_reason")!=null)deal_reason = map.get("deal_reason").toString();
					if(map.get("user_id2")!=null)user_id2=map.get("user_id2").toString();
					if(map.get("deal_date")!=null)deal_date=map.get("deal_date").toString();
					String state_name = "";
					if(map.get("file_path")!=null)file_path = map.get("file_path").toString();
					if(pub_state.equals("0")){
						state_name="<font color='red'>未处理</font>";
					}else if(pub_state.equals("1")){
						state_name="<font color='green'>正在处理</font>";
					}else if(pub_state.equals("2")){
						state_name="处理结束";
					}
					if(file_path.equals("")){
						 file_path ="/program/admin/images/cpwu.gif";            
					}
		  %>
		
			<tr>
				<td width="10%" align="left" valign="middle">
					<a href="/program/admin/forReturn/updateInfo.jsp?order_no=<%=order_no%>">
					<img src="<%=file_path%>" width="60" height="60" border="0"/></a>
					
				</td>
				<td width="40%" align="left" valign="middle">
					<%=goods_name%>
					<br/>
					退货单号:<%=info_id%>
				</td>
				<td width="15%" align="left">
				<a href="/program/admin/forReturn/updateInfo.jsp?order_no=<%=order_no%>"><%=order_no%></a>
				</td>
				<td width="15%" align="left"><%=state_name%></td>
				<td width="15%" align="left"><%=in_date%></td>
				<td width="10%" align="left">
					<a href="pubInfo.jsp?detail_id=<%=info_id%>&<%=para%>"><img src="/program/admin/images/edit.gif" /></a>
				</td>
            </tr>
		
		<%
			}
	  %>
		
	</table>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="90%">
				<!--input type="button" name="delInfo" onclick="delIndexInfo()" value="删除" class="buttab"/-->
			</td>
			<td>
				总计:<%=counter %>条
			</td>
		</tr>
	</table>
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe">
		<tr><td><%=pageString %></td></tr>
	</table>
	
	<%
		 }
	%>
	
	  <input type="hidden" name="listsize" id="listsize" value="<%=listsize %>" />
	  <input type="hidden" name="pkid" id="pkid" value="" />
	  <input type="hidden" name="bpm_id" id="bpm_id" value="8682" />
	  </form>
</body>

</html>
